package br.com.fafica.sisape.view;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.Color;
import javax.swing.JLabel;

import br.com.fafica.sisape.control.ControllerAgendas;
import br.com.fafica.sisape.model.AgendaConsulta;
import br.com.fafica.sisape.model.AgendaExame;

import java.awt.Font;
import java.awt.TextArea;
import java.util.ArrayList;

public class TelaUsuarioProximosExames extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					TelaUsuarioProximasConsultas frame = new TelaUsuarioProximasConsultas();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public TelaUsuarioProximosExames() {
		setResizable(false);
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 270, 410);
		contentPane = new JPanel();
		contentPane.setBackground(Color.WHITE);
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblPrximasConsultas = new JLabel("Pr\u00F3ximos Exames:");
		lblPrximasConsultas.setForeground(new Color(0, 0, 128));
		lblPrximasConsultas.setFont(new Font("Tahoma", Font.PLAIN, 14));
		lblPrximasConsultas.setBounds(10, 11, 158, 32);
		contentPane.add(lblPrximasConsultas);
		
		TextArea campoProximosExames = new TextArea();
		campoProximosExames.setBounds(10, 49, 244, 322);
		contentPane.add(campoProximosExames);
		
		ControllerAgendas control = new ControllerAgendas();
		ArrayList lista = control.listarAgendaExame();
		AgendaExame agenda;
		String menu = "";
		
		for(int i=0; i < lista.size(); i++){
			agenda = (AgendaExame) lista.get(i);
			menu = menu + "\n"+"Data: "+agenda.getData()+"\nHora: "+agenda.getHora()+"\nClinica: "+agenda.getClinica()+"\n\n";
		}
		campoProximosExames.setText(menu);
	}
}